def get_url(dbinfo):
    dialect=dbinfo.get('DIALECT') or 'sqlite'
    driver=dbinfo.get('DRIVER') or 'sqlite'
    username=dbinfo.get('USERNAME') or ''
    password=dbinfo.get('PASSWORD') or ''
    host=dbinfo.get('HOST') or ''
    port=dbinfo.get('PORT') or ''
    database=dbinfo.get('DATABASE') or ''
    return "{}+{}://{}:{}@{}:{}/{}?charset=utf8".format(dialect,driver,username,password,host,port,database)

class Config:
    DEBUG=False
    TESTING=False



class DevelopConfig(Config):
    DEBUG = True
    dbinfo={
        'DIALECT':'mysql',
        'DRIVER':'pymysql',
        'USERNAME':'root',
        'PASSWORD':'yi120802',
        'HOST':'localhost',
        'PORT':'3306',
        'DATABASE':'2019_ncov'

    }
    SQLALCHEMY_DATABASE_URI = get_url(dbinfo)


class TestingConfig(Config):
    TESTING = True
    dbinfo = {
        'DIALECT': 'mysql',
        'DRIVER': 'pymysql',
        'USERNAME': 'root',
        'PASSWORD': 'yi120802',
        'HOST': 'localhost',
        'PORT': '3306',
        'DATABASE': '2019_ncov'

    }
    SQLALCHEMY_DATABASE_URI = get_url(dbinfo)

get_set={
    'develop':DevelopConfig,
    'testing':TestingConfig
}
